
import 'package:flutter/material.dart';
import 'package:flutter_hotwork/Myapplication.dart';
import 'package:flutter_hotwork/homepage/BaseTitleBar.dart';
import 'package:flutter_hotwork/homepage/BaseViewBar.dart';
import 'package:flutter_hotwork/utils/DioUtils.dart';
import 'package:fluttertoast/fluttertoast.dart';

import '../Login.dart';
import '../Toast.dart';
import '../AboutActivity.dart';

class MineScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    double rpx = MediaQuery.of(context).size.width / 750;
    return Scaffold(
//      appBar: new BaseViewBar(
//          childView: new BaseTitleBar(
//            "我的",
//            leftIcon: '',
//            rightIcon:  '',
//            rightClick: () {
//              print("点击了右边干嘛啊。。。哦");
//            },
//            leftClick: () {
//              print("点击了左边干嘛啊。。。哦");
//            },
//          ),
//          preferredSize: Size.fromHeight(50.0)),
      body:
          Container(
        child:
        Column(
          children: [
            Container(
              width: 750*rpx,
              height: 25,
              color: Color(0xFF4188F2),

            ),
            Container(
              width: 750*rpx,
              alignment: Alignment.center,
              height: 50,
              child: Text("个人中心",style: TextStyle(fontSize: 16,color: Colors.white),),
              color: Color(0xFF4188F2),

            ),
            Container(
              width: rpx*750,
              height: rpx*300,
              padding: EdgeInsets.only(left: 0,top: 10,right: 0,bottom: 0),
              color: Color(0xFF4188F2),
              // decoration: BoxDecoration(
              //   image: DecorationImage(
              //     image: AssetImage("images/minebg.jpg"),
              //     fit: BoxFit.fill,
              //   ),
              // ),
              child: Column(
                children: [
                  Row(

                    children: [
                      Container(
                        width: rpx*20,
                      ),
                      CircleAvatar(
                        //头像半径
                        radius: 20,
                        backgroundImage: NetworkImage(
                            MyApplication.loginuserinfo.userInfo.avatar!=null?DioUtils.API_PREFIX+"/"+MyApplication.loginuserinfo.userInfo.avatar:"http://5b0988e595225.cdn.sohucs.com/q_70,c_zoom,w_640/images/20200201/43d42a8c4ae64ae8b10e6189d7ab6b1c.jpeg"
                        ),
                      ),
                      Container(
                        width: 10,
                      ),
                      Column(
                        crossAxisAlignment:CrossAxisAlignment.start,

                        children: [
                          Text(MyApplication.loginuserinfo.userInfo.realname,style: TextStyle(color: Colors.white,fontSize: 14),),
                          Text(MyApplication.loginuserinfo.departs.length>0?MyApplication.loginuserinfo.departs[0].departName:"",style: TextStyle(color: Colors.white,fontSize: 12),),

                        ],),

                    ],
                  ),

                  Flexible(fit: FlexFit.tight, child: SizedBox()),
                  Container(
                    height: 80,
                    margin: EdgeInsets.only(left: 0, right: 0, top:10, bottom: 0),
                    padding:  EdgeInsets.only(left: 10, right: 0, top:0, bottom: 0),
                    decoration: BoxDecoration(
//                  border: new Border.all(color: Color(0xFF9E9E9E), width: 0.5), // 边色与边宽度
//                       color: Colors.transparent, // 底色
                      image: DecorationImage(
                        image: AssetImage("images/minebg.png"),
                        fit: BoxFit.fill,
                      ),
                      //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                      // borderRadius: BorderRadius.all(Radius.circular(5)),
                    ),
                    child:
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                          width: 110,
                          padding:  EdgeInsets.only(left: 0, right: 0, top:20, bottom: 0),
                          child:
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
//                      textDirection: TextDirection.,
                            children: [
                              Text("值班人",style: TextStyle(color: Colors.white,fontSize: 14),),
                              Text("",style: TextStyle(color: Colors.white,fontSize: 14),),

                            ],
                          ),
                        ),
                        Container(
                          width: 0.5,
                          margin: EdgeInsets.only(left: 0, right: 0, top:20, bottom: 0),
                          height: 30,
                          decoration: BoxDecoration(
//                  border: new Border.all(color: Color(0xFF9E9E9E), width: 0.5), // 边色与边宽度
                            color: Colors.white, // 底色
                            //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                            borderRadius: BorderRadius.all(Radius.circular(5)),
                          ),

                        ),

                        Container(
                          width: 110,
                          padding:  EdgeInsets.only(left: 0, right: 0, top:20, bottom: 0),
                          child:
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Text("电话",style: TextStyle(color: Colors.white,fontSize: 14),),
                              Text(MyApplication.loginuserinfo.userInfo.phone!=null?MyApplication.loginuserinfo.userInfo.phone:"",style: TextStyle(color: Colors.white,fontSize: 14),),
                            ],

                          ),
                        ),
                        Container(
                          width: 0.5,
                          margin: EdgeInsets.only(left: 0, right: 0, top:20, bottom: 0),
                          height: 30,
                          decoration: BoxDecoration(
//                  border: new Border.all(color: Color(0xFF9E9E9E), width: 0.5), // 边色与边宽度
                            color: Colors.white, // 底色
                            //        borderRadius: new BorderRadius.circular((20.0)), // 圆角度
                            borderRadius: BorderRadius.all(Radius.circular(5)),
                          ),

                        ),
                        Container(
                          width: 110,
                          padding:  EdgeInsets.only(left: 0, right: 0, top:20, bottom: 0),
                          child:
                          Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              Text("负责人电话",style: TextStyle(color: Colors.white,fontSize: 14),),
                              Text("",style: TextStyle(color: Colors.white,fontSize: 14),),
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),

                ],
              ),
            ),




            Container(
              margin: EdgeInsets.only(left: 0,top: 0,right: 0,bottom: 0),
              width: rpx*750,
              color: Color(0xFFF6F6F6),
              height: rpx*700,
              child: Column(
                // mainAxisAlignment:MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  // Container(
                  //   color: Colors.white,
                  //   height: rpx*79,
                  //   margin: EdgeInsets.only(left: 0,right: 0,top: 0,bottom: 10),
                  //   padding: EdgeInsets.only(left: 0,right: 10,top: 0,bottom: 0),
                  //   child:
                  //   Row(
                  //     crossAxisAlignment: CrossAxisAlignment.center,
                  //     children: [
                  //       Image(
                  //         height: 20,
                  //         width: 40,
                  //         image:AssetImage("images/xinxi.png"),),
                  //       Text("基本信息"),
                  //       Flexible(fit: FlexFit.tight, child: SizedBox()),
                  //       Image(
                  //         height: 13,
                  //         width: 13,
                  //         image:AssetImage("images/xiayibu.png"),),
                  //     ],
                  //   )
                  //   ,
                  //
                  // ),
                  InkWell(
                    onTap: (){
                      Navigator.push(context, MaterialPageRoute(builder: (context) {
                        return new aboutPage();
                      }));
                    }
                    ,
                    child:
                    Container(
                      margin: EdgeInsets.only(left: 0,right: 0,top: 0,bottom: 10),
                      padding: EdgeInsets.only(left: 0,right: 10,top: 0,bottom: 0),
                      color: Colors.white,
                      height: rpx*79,
                      child:
                      Row(
                        children: [
                          Image(
                            height: 20,
                            width: 40,
                            image:AssetImage("images/guanyuwomen.png"),),
                          Text("关于我们"),
                          Flexible(fit: FlexFit.tight, child: SizedBox()),
                          Image(
                            height: 13,
                            width: 13,
                            image:AssetImage("images/xiayibu.png"),),

                        ],
                      )
                      ,
                    ),
                  ),
                  InkWell(
                    onTap: (){
                       LocalToast.toast(context,msg: "已是最新版本！");
                    }
                    ,
                    child:
                    Container(
                      margin: EdgeInsets.only(left: 0,right: 0,top: 0,bottom: 10),
                      padding: EdgeInsets.only(left: 0,right: 10,top: 0,bottom: 0),
                      color: Colors.white,
                      height: rpx*79,
                      child:
                      Row(
                        children: [
                          Image(
                            height: 20,
                            width: 40,
                            image:AssetImage("images/xitonggengxin.png"),),
                          Text("系统更新"),
                          Flexible(fit: FlexFit.tight, child: SizedBox()),
                          Image(
                            height: 13,
                            width: 13,
                            image:AssetImage("images/xiayibu.png"),),

                        ],
                      )
                      ,
                    ),
                  ),
                  InkWell(
                    onTap: (){
                      //跳转并关闭当前页面
                      Navigator.pushAndRemoveUntil(
                        context,
                        new MaterialPageRoute(builder: (context) => new MyHomePage()),
                            (route) => route == null,
                      );
                    }
                    ,
                    child:
                    Container(
                      margin: EdgeInsets.only(left: 0,right: 0,top: 0,bottom: 10),
                      padding: EdgeInsets.only(left: 0,right: 10,top: 0,bottom: 0),
                      color: Colors.white,
                      height: rpx*79,
                      child:
                      Row(
                        children: [
                          Image(
                            height: 20,
                            width: 40,
                            image:AssetImage("images/zhuxiao.png"),),
                          Text("注销"),
                          Flexible(fit: FlexFit.tight, child: SizedBox()),
                          Image(
                            height: 13,
                            width: 13,
                            image:AssetImage("images/xiayibu.png"),),

                        ],
                      )
                      ,
                    ),
                  ),
                ],

              ),

            ),
          ],

        ),
      ),

    );
  }
}